<template>
  <el-dialog
    class="MonitorSufaceEdtior"
    title="修改地表下沉数据"
    :visible.sync="dialogEditorVisible"
    width="50%"
    :before-close="handleClose">
  <el-form   :inline="true"  ref="form" class="demo-form-inline" :model="currentRow"  label-width="120px">
    <el-form-item label="测量时间">
          <el-date-picker
            type="date"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期"
            v-model="currentRow.createTime"
            style="width: 100%;"
          ></el-date-picker>
        </el-form-item>
        <!-- 必填 -->
        <el-form-item label="ZD当日沉降"> 
          <el-input v-model="currentRow.zdTodaySink"></el-input>
        </el-form-item>
        <el-form-item label="Z1当日沉降">
          <el-input v-model="currentRow.z1TodaySink"></el-input>
        </el-form-item>
        <el-form-item label="Z2当日沉降">
          <el-input v-model="currentRow.z2TodaySink"></el-input>
        </el-form-item>
        <el-form-item label="Z3当日沉降">
          <el-input v-model="currentRow.z3TodaySink"></el-input>
        </el-form-item>
        <el-form-item label="Y1当日沉降">
          <el-input v-model="currentRow.y1TodaySink"></el-input>
        </el-form-item>
        <el-form-item label="Y2当日沉降">
          <el-input v-model="currentRow.y2TodaySink"></el-input>
        </el-form-item>
        <el-form-item label="Y3当日沉降">
          <el-input v-model="currentRow.y3TodaySink"></el-input>
        </el-form-item>
</el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogEditorVisible = false">取 消</el-button>
      <el-button type="primary" @click="create">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>

import api from "../../../api";
import qs from "qs"

export default {
  data(){
    return {
      dialogEditorVisible: false,
      currentRow: {}
    }
  },
   props: {
    flag: {
      type: Boolean,
      default: false,
    },
  },
  mounted() {
    this.$bus.$on("onShowMonitorSurfaceEditor", (row) => {
       this.dialogEditorVisible = true;
       this.currentRow = row
     })
  },
  methods: {
      handleClose(done) {
              this.$confirm('确认关闭？')
                .then(_ => {
                 
                  done();
                }).catch(_ => {});
      },
      create(){
        api.monitorSurfaceUpdate(qs.stringify(this.currentRow)).then(res=>{
          if (res.data.code == 2001){
                this.$message({
                  type: 'success',
                  message: '更新成功!'
                });
               this.dialogEditorVisible = false
          }

        }).catch(err=>{
        })
      },
      onSubmit() {
        console.log('submit!');
      }

  }

}
</script>

<style scoped>
  .avatar-uploader .el-upload {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 1px dashed #d9d9d9;
    border-radius: 6PX;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    width: 50PX !important;
    height: 50PX !important;
    font-size: 28PX;
    line-height: 50PX !important;
    color: #8c939d;
    text-align: center;
  }
  .avatar {
    display: block;
    width: 50PX !important;
    height: 50PX !important;
  }
  .imgbeforepad{
    padding-top: 0px !important;
  }
  .avatar-uploader .el-icon-plus{
    margin: 15PX !important;
  }
.MonitorSufaceEdtior :deep(.el-input--suffix .el-input__inner){
  width: 202px;
}
.MonitorSufaceEdtior :deep(.el-textarea__inner){
  width: 202px;
}
.MonitorSufaceEdtior :deep(.el-form--inline .el-form-item__content){
  width: 202px;
}

</style>